package com.yc.boot.train.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yc.boot.train.model.find.CourseCount;
import com.yc.boot.train.model.find.GradeFeedBack;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Create with IntelliT IDEA
 *
 * @Author: zhengmingzhe
 * @Date: 2022/02/09/10:35
 * @Description: 统计课程人数
 */
@Mapper
public interface CourseCountMapper extends BaseMapper<CourseCount> {
    @Select("select g.course_id as courseId,t.course_name as courseName,count(g.course_id)as courseNumber  from " +
            "grade_comment_feedback as g  join train_course as t on g.course_id =t.id group by " +
            "g.course_id ${ew.customSqlSegment}")
    List<CourseCount> queryCourseCount(@Param(Constants.WRAPPER) LambdaQueryWrapper<CourseCount> wrapper);
}
